# with open('D:\cqz\游戏账号.txt', 'r', encoding='utf-8') as f:
# with open('D:\\cqz\\test.txt', 'r', encoding='gbk') as f:
#     lines = f.readlines()
#
# with open('D:\\cqz\\test.txt', 'w', encoding='gbk') as new_f:
#     for line in lines:
#         if 'd' in line:
#             line = line.replace('d', '的')
#             print(line)
#         new_f.write(line)

# python list去重方法及效率
# 1, 循环效率不行，但是此方法保证了列表的顺序性。
# li = [1, 2, 4, 4, 5, 3, 6, 7, 9]
# new_li = []
# for i in li:
#     if i not in new_li:
#         new_li.append(i)
# print(new_li)

# set去重,简单快速但顺序乱了
li = [1, 2, 4, 4, 5, 3, 6, 7, 9]
lis = list(set(li))
print(li)
print(lis)
lis.sort(key=li.index)
print(lis)
{'code': 0, 'data': {'calendar': {'calendar_id': 'feishu.cn_kYTlvLKIK4pKP066eImavc@group.calendar.feishu.cn', 'color': -1, 'description': '中文字符测试', 'permissions': 'public', 'role': 'owner', 'summary': '中文', 'summary_alias': 'permissions_public日历', 'type': 'shared'}}, 'msg': 'success'}
PASSED

{'code': 0, 'data': {'calendar_list': [{'calendar_id': 'feishu.cn_qfNEJo8khJVAEcdITc5lrg@group.calendar.feishu.cn', 'color': -1, 'description': '使用开放接口创建日历', 'permissions': 'private', 'role': 'owner', 'summary': '测试', 'summary_alias': '日历备注名', 'type': 'primary'}], 'has_more': True, 'page_token': 'ListCalendarsPageToken_MgAFyVORtfaIYRR4lhjUQANhFHiWGNRAAw==', 'sync_token': ''}, 'msg': 'success'}
PASSED